其他
神挡杀神——揭开世界第一手游保护nProtect的神秘面纱
一
导出符号干扰
sym_count = 0x26c
ini_start = 0x6AA0
ini_end = 0xCC60
inName = "F:\\np\\libcompatible.so"
outName = "F:\\np\\libcompatible_p.so"
with open(inName,'rb') as f:
data = list(f.read())
#遍历符号表
for i in range(sym_count):
tmp_sym_start = sym_start + i * 0x18
tmp_value_start = tmp_sym_start + 8 #符号地址
if getInt32(data,tmp_value_start) % 2 == 1 or ( ini_start <= getInt32(data,tmp_value_start) <= ini_end):
#在init函数内,抹零
putInt64(data,tmp_value_start,0)
putInt64(data,tmp_value_start+8,0)
putInt64(data,tmp_value_start+0x10,0)
with open(outName,'wb') as f:
f.write(bytes(data))
二
libcompatible.so
2.1 I3函数分析
2.2 JNI_OnLoad函数分析
2.3 sub_189c分析
2.3.1 process_libc函数
2.3.1.1 保存系统libc函数地址
2.3.1.2 加载Secure Libc
2.3.2 检查xposed
2.3.3 antidebug
三
libstub.so
3.1 real_so_library_start执行流程
3.2 修复
3.3 libstub.so内部窥探
3.4 load engine
四
libengine.so
4.1 斐波那契数列与魔改aes
0xb4 0x66 0x34 0x99 0x6e0x450x80 0x9a0xaa0xeb 0x030x430x25 0x7b 0x51 0x02
0x16 0xaf0x260x0b 0x1c 0x11 0x5d 0xe0 0xf9 0xee 0xb0 0x3b 0xb7 0x58 0xa1 0xe9
0x43 0x950x050x7d 0x2d 0xe2 0x010xd90xd50x550x3e 0x73 0x08 0x09 0x57 0xf1
0x7d0x8d 0x2f 0x49 0xf1 0x27 0x9d 0x48 0x970xad0x72 0x3f 0x680xd30x9a 0x17
jmpids = [2,3,5,8,0xd,0x15,0x22,0x37,0x9,0x40,0x49,0x39,0x32,0x1b,0x4d,0x18]
def buildKey(rawdata):
outkey = []
outkey.append(0)
for i in range(1,len(jmpids)):
outkey.append(rawdata[jmpids[i]])
for i in range(4):
for j in range(2):
tmp = outkey[4*i+j]
outkey[4*i+j] = outkey[4*i+3-j]
outkey[4 * i + 3 - j] = tmp
return outkey
def decryptStr(raw,item):
offset = item["data"]
rawdata = raw[offset:offset+0x50]
newdata = []
key = buildKey(rawdata)
for i in range(0x50):
if i in jmpids:
continue
else:
newdata.append(rawdata[i])
out = AES.AES128_ECB_encrypt(data1,key)
res = []
end = False
for i in range(5):
for j in range(0x10):
val = (out[j] ^ newdata[i*0x10 + j])&0xff
if val == 0:
end = True
break
else:
res.append(val)
if len(res) > 60:
end = True
out = AES.AES128_ECB_encrypt(newdata[i*0x10:(i+1)*0x10],key)
if end:
break
if "index" in item:
return hex(item["index"])+":"+str(bytes(res))
elif "line" in item:
return item["line"]+":"+str(bytes(res))
4.2 一些检测手段分析
4.2.1 root检测:
4.2.2 对作弊器的检查:
4.2.3 usb调试检查
4.3 执行流程
五
最后的保护——服务器认证
六
后记
看雪ID:乐子人
https://bbs.kanxue.com/user-home-872365.htm
# 往期推荐
1、2023 SDC 议题回顾 | 芯片安全和无线电安全底层渗透技术
6、2023 SDC 议题回顾 | 深入 Android 可信应用漏洞挖掘
球分享
球点赞
球在看